import React,{useState,useEffect} from 'react'
import stort from './store/index.js'
import actions from './store/actionCreators.js'
export default function App() {
    const [count,setCount] = useState(stort.getState().count)
    function increnet(){
        actions.add()
    }
    useEffect(()=>{
        stort.subscribe(()=>{
            setCount(stort.getState().count)
        })
    },[])
    return (
        <div>
            <h1>{count}</h1>
            <button onClick={increnet}>+</button>
        </div>
    )
}
